package com.example.base.entity;

import com.example.base.checker.IllegalPwdCheck;
import com.example.base.checker.UniqueCheck;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Component
public class User {
    private Integer id;
    private Integer uid;

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式错误")
    @UniqueCheck
    private String email;

    @NotBlank(message = "密码不能为空")
    @IllegalPwdCheck
    private String passWord;

    private Boolean isDel = true;
    @Valid
    private UserInfo userInfo;

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", uid=" + uid +
                ", email='" + email + '\'' +
                ", passWord='" + passWord + '\'' +
                ", isDel=" + isDel +
                ", userInfo=" + userInfo +
                '}';
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Boolean getDel() {
        return isDel;
    }

    public void setDel(Boolean del) {
        isDel = del;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

}
